Repository navigation
test: cover TCP demand after peer write closure - #3817
Merged
He-Pin merged 1 commit intoNov 29, 2026
Merged
Conversation
Motivation: Existing TCP half-close tests consume the peer's final data before waiting for the peer to close. A subscriber may first request that data after the peer has completed its writes. Modification: Use an OS-assigned loopback port, observe the client's write-side closure, and wait for the peer's write and close acknowledgements before requesting the reply. Check the exact data and completion. Clean up the subscriber, listener and registered peer independently. Result: The native TCP test covers application demand after peer output closure. No runtime behavior or public API changes. Tests: - Stock sbt: the focused TcpSpec case passed on Scala 2.13.18 and 3.3.9 with JDK 17. - stream-tests Test scalafmtCheck, headerCheck and git diff --check passed. References: Netty 5.0 and 4.2 SocketHalfClosedTest data-drain coverage, used as behavioral comparison only. No upstream source copied.
He-Pin
marked this pull request as ready for review
November 27, 2026 19:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Existing TCP half-close tests request the response before the peer has closed its write side. A subscriber can first request data after the peer has completed its writes.
Modification
Use a loopback peer on an OS-assigned port. After the client closes its write side, require the peer to acknowledge its final write and write-side closure before issuing the first application demand for the reply. Check the exact data and completion.
Result
Covers this normal TCP lifecycle without timing sleeps or runtime changes. The test makes no assertion about when the client kernel receives the FIN or about internal prefetch.
Tests
The single focused TcpSpec case passed on both Scala 2.13.18 and 3.3.9 with JDK 17. Scoped test formatting and license checks passed.
References
Netty 5.0 and 4.2 SocketHalfClosedTest data-drain coverage informed this independently written test.